<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
</head>
<body>
	<script type="text/javascript">
function delete_confirm()
{
	return confirm("您真的要删除这个字段么？（删除之后相关病症分析算法将失效）");
}

</script>

	<style type="text/css">
td {
	width: 140px;
	background-color: #C4E1FF;
	font-size: 13pt;
	text-align: center;
}
</style>

	<center>
		<label><strong>健康信息</strong>
		</label> <br> <br>
		<form action="<?php echo site_url("admin/add_field");?>"
			onSubmit="return confirm('您真的要增加这项信息么？')" method='post'>
			<label><strong>增加一项信息</strong> </label> <br> <label>字段名</label> <input
				name="field" type="text"></input> <label>描述</label> <input
				name="desc" type="text"></input> <select name="type">
				<?php
				$map = get_health_info_type_map();
				foreach ($map as $code=>$type){
					echo "<option value=\"$code\">$type</option>";
				}
				?>
			</select> <input type="submit" value="确定"></input>
		</form>
		<table>
			<?php
			$health_field = $health_info["field"];
			$health_desc = $health_info["desc"];
			$health_field_type = $health_info["type"];
			for($i = 0; $i < count($health_field); $i ++){
				$field = $health_field[$i];
				$desc = $health_desc[$i];
				$type = $health_field_type[$i];

				echo "<tr>";
				echo "<td>";
				echo "<span>$field</span>";
				echo "</td>";

				echo "<td>";
				echo "<span>$desc</span>";
				echo "</td>";

				echo "<td>";
				echo "<span>$type</span>";
				echo "</td>";

				echo "<td>";
				if(can_delete_field($field))
					echo "<a href=\"".site_url("admin/remove_field"."/$field")."\" onClick=\"delete_confirm()\">删除</a>";
				else 
					echo "<label>不可删除</label>";
				echo "</td>";
				echo "</tr>";
			}
			?>

		</table>

	</center>
</body>

</html>
